# -*- coding: utf-8 -*-
#
# Copyright 2009 Vanderbilt University
# 
# Licensed under the Apache License, Version 2.0 (the "License"); 
# you may not use this file except in compliance with the License. 
# You may obtain a copy of the License at 
# 
#     http://www.apache.org/licenses/LICENSE-2.0 
# 
# Unless required by applicable law or agreed to in writing, software 
# distributed under the License is distributed on an "AS IS" BASIS, 
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
# See the License for the specific language governing permissions and 
# limitations under the License. 

"""Module for the parallel processing of tasks. Avoids the global interpreter 
lock, thus allowing a single Python process to take advantage of 
multiple processors. An optimal use is for plugins that can process several
network graphs in parallel.

:mod:`hornet.task` is a leaky wrapper for :mod:`multiprocessing`.  If using
Python <2.6, it requires pyprocessing.

>>> f = lambda x: x**x
>>> p = Pool()              #doctest: +SKIP
>>> p.map(f, [1, 4, 10])    #doctest: +SKIP
[1, 16, 100]

.. moduleauthor:: John Paulett <john.paulett -at- vanderbilt.edu>
"""
try:
    ## for python 2.6+
    from multiprocessing import Pool
except ImportError:
    ## requires pyprocessing - http://pyprocessing.berlios.de/
    from processing import Pool

